package com.datang.petstore.controller;


/*
* @auther 顶风少年 
* @mail dfsn19970313@foxmail.com
* @date 2019-11-01 15:30
* @notify 微博点赞
* @version 1.0
*/

import com.datang.petstore.aop.ForbidAnnotation;
import com.datang.petstore.model.LikeRecordRequest;
import com.datang.petstore.resultpage.Result;
import com.datang.petstore.service.MicroblogLikeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MicroblogLikeRecordController {

    @Autowired
    private MicroblogLikeRecordService microblogLikeRecordService;

    /*
     * @author 顶风少年
     * @date 2019/11/1 7:26
     * @mail dfsn199703132038@foxmail.com
     * @throws
     * @param
     * @param likeRecord
     * @result com.datang.petstore.utils.Result
     * @notify 点赞
     * version 1.0
     */
    @PostMapping(value="microblog/like")
    @ForbidAnnotation
    public Result addLike(@RequestBody LikeRecordRequest likeRecordRequest) {

        //点赞
        microblogLikeRecordService.addLike(likeRecordRequest.getUserId(), likeRecordRequest.getMicroblogId());

        return Result.ok();
    }
}
